export const getPaginationRange = (pageNumber: number, pageSize: number, totalPages: number) => {
    const delta = 2;
    const range = [];
    const left = Math.max(2, pageNumber - delta);
    const right = Math.min(totalPages - 1, pageNumber + delta);

    for (let i = left; i <= right; i++) {
        range.push(i);
    }

    if (pageNumber - delta > 2) {
        range.unshift('...');
    }
    if (pageNumber + delta < totalPages - 1) {
        range.push('...');
    }

    range.unshift(1);
    if (totalPages > 1) {
        range.push(totalPages);
    }

    return range;
};